﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;

namespace WebAPI.Controllers
{
    public class CommentController : BaseApiController
    {

        public IEnumerable<Comment> GetCommentByGoodsId(int id)
        {
            var list = from c in db.Comment where c.GoodsID == id select c;

            foreach (var item in list)
            {
                item.DisplayTime = item.CommentTime.ToString("yyyy-MM-dd hh:mm:ss");
            }

            return list;
        }
    }
}
